"return": 0,
}
- def closeConsole(self):
+ def __closeConsole(self):
"""Closes the console connection and ensures that the console
- process is killed"""
- os.close(self.consoleFd)
- os.kill(self.consolePid, 2)
+ process is killed. This should only be called by the domain.
+ Tests should call domain.closeConsole()"""
+ if self.consolePid != 0:
+ os.close(self.consoleFd)
+ os.kill(self.consolePid, 2)
+ self.consolePid = 0
def setLimit(self, limit):
self.limit = int(limit)
except Exception, e:
self.limit = None
+
+ def setHistorySaveCmds(self, value):
+ # True or False
+ self.historySaveCmds = value
if __name__ == "__main__":
print "Console failed (%)" % str(e)
sys.exit(255)
- t.closeConsole()
+ t._XmConsole__closeConsole()
print run["output"],
sys.exit(run["return"])
domain = XmTestDomain()
try:
- domain.start()
- console = XmConsole(domain.getName())
+ console = domain.start()
console.runCmd("ls")
except DomainError, e:
return True
from Xm import *
from Test import *
from config import *
+from Console import *
BLOCK_ROOT_DEV = "hda"
self.name = getUniqueName()
self.config = config
+ self.console = None
+
# Set domain type, either PV for ParaVirt domU or HVM for
# FullVirt domain
if ENABLE_HVM_SUPPORT:
else:
self.type = "PV"
- def start(self):
+ def start(self, noConsole=False):
ret, output = traceCommand("xm create %s" % self.config)
if self.getDomainType() == "HVM":
waitForBoot()
+ if self.console and noConsole == True:
+ self.closeConsole()
+
+ elif self.console and noConsole == False:
+ return self.console
+
+ elif not self.console and noConsole == False:
+ return self.getConsole()
+
def stop(self):
prog = "xm"
cmd = " shutdown "
+ if self.console:
+ self.closeConsole()
+
ret, output = traceCommand(prog + cmd + self.config.getOpt("name"))
return ret
prog = "xm"
cmd = " destroy "
+ if self.console:
+ self.closeConsole()
+
ret, output = traceCommand(prog + cmd + self.config.getOpt("name"))
return ret
def getDomainType(self):
return self.type
+ def closeConsole(self):
+ # The domain closeConsole command must be called by tests, not the
+ # console's close command. Once close is called, the console is
+ # gone. You can't get history or anything else from it.
+ if self.console:
+ self.console._XmConsole__closeConsole()
+ self.console = None
+
+ def getConsole(self):
+ if self.console:
+ self.closeConsole()
+
+ self.console = XmConsole(self.getName())
+ # Activate the console
+ self.console.sendInput("input")
+
+ return self.console
+
class XmTestDomain(XenDomain):
domain = XmTestDomain()
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
FAIL(str(e))
try:
- console = XmConsole(domain.getName())
- console.sendInput("foo")
run = console.runCmd("cat /proc/cpuinfo")
except ConsoleError, e:
FAIL(str(e))
domain = XmTestDomain()
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
# Attach a console to it
try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
- FAIL(str(e))
-
-try:
- # Activate the console
- console.sendInput("input")
+ console.setHistorySaveCmds(value=True)
# Run 'ls'
run = console.runCmd("ls")
except ConsoleError, e:
FAIL(str(e))
# Close the console
-console.closeConsole()
+domain.closeConsole()
# Stop the domain (nice shutdown)
domain.stop()
domain = XmTestDomain()
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-# Attach a console to it
+# Set console to save commands and make sure we can run cmds
try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
- FAIL(str(e))
-
-try:
- # Activate the console
- console.sendInput("input")
+ console.setHistorySaveCmds(value=True)
# Run 'ls'
run = console.runCmd("ls")
except ConsoleError, e:
FAIL(str(e))
# Close the console
-console.closeConsole()
+domain.closeConsole()
# Stop the domain (nice shutdown)
domain.stop()
domain = XmTestDomain()
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-# Attach a console to it
try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
- FAIL(str(e))
-
-try:
- # Activate the console
- console.sendInput("input")
+ console.setHistorySaveCmds(value=True)
# Run 'ls'
run = console.runCmd("ls")
except ConsoleError, e:
FAIL("Device is not actually attached to domU")
# Close the console
-console.closeConsole()
+domain.closeConsole()
# Stop the domain (nice shutdown)
domain.stop()
domain = XmTestDomain()
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-# Attach a console to it
try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
- FAIL(str(e))
-
-try:
- # Activate the console
- console.sendInput("input")
+ console.setHistorySaveCmds(value=True)
# Run 'ls'
run = console.runCmd("ls")
except ConsoleError, e:
FAIL("Failed to dettach block device: /proc/partitions still showing that!")
# Close the console
-console.closeConsole()
+domain.closeConsole()
# Stop the domain (nice shutdown)
domain.stop()
domain = XmTestDomain()
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-# Attach a console to it
try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
- FAIL(str(e))
-
-try:
- # Activate the console
- console.sendInput("input")
+ console.setHistorySaveCmds(value=True)
# Run 'ls'
run = console.runCmd("ls")
except ConsoleError, e:
FAIL(str(e))
# Close the console
-console.closeConsole()
+domain.closeConsole()
# Stop the domain (nice shutdown)
domain.stop()
domain = XmTestDomain()
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-# Attach a console to it
try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
- FAIL(str(e))
-
-try:
- # Activate the console
- console.sendInput("input")
+ console.setHistorySaveCmds(value=True)
# Run 'ls'
run = console.runCmd("ls")
except ConsoleError, e:
FAIL(str(e))
# Close the console
-console.closeConsole()
+domain.closeConsole()
# Stop the domain (nice shutdown)
domain.stop()
domain = XmTestDomain()
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-# Attach a console to it
try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
- FAIL(str(e))
-
-try:
- # Activate the console
- console.sendInput("input")
+ console.setHistorySaveCmds(value=True)
# Run 'ls'
run = console.runCmd("ls")
except ConsoleError, e:
FAIL("Failed to dettach block device: /proc/partitions still showing that!")
# Close the console
-console.closeConsole()
+domain.closeConsole()
# Stop the domain (nice shutdown)
domain.stop()
domain = XmTestDomain()
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-# Attach a console to it
try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
- FAIL(str(e))
-
-try:
- # Activate the console
- console.sendInput("input")
+ console.setHistorySaveCmds(value=True)
# Run 'ls'
run = console.runCmd("ls")
except ConsoleError, e:
FAIL(msg)
# Close the console
-console.closeConsole()
+domain.closeConsole()
# Stop the domain (nice shutdown)
domain.stop()
domain = XmTestDomain(extraConfig=config)
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print e.extra
FAIL("Unable to create domain")
try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
- console.sendInput("input")
+ console.setHistorySaveCmds(value=True)
run = console.runCmd("cat /proc/partitions | grep hda1")
run2 = console.runCmd("cat /proc/partitions")
except ConsoleError, e:
saveLog(console.getHistory())
FAIL(str(e))
-console.closeConsole()
+domain.closeConsole()
domain.stop()
if run["return"] == 0:
domain = XmTestDomain()
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print e.extra
pass
try:
- console = XmConsole(domain.getName())
-except ConsoleError, e:
- FAIL(str(e))
-
-try:
- console.sendInput("input")
run = console.runCmd("cat /proc/partitions | grep hda1")
except ConsoleError, e:
saveLog(console.getHistory())
saveLog(console.getHistory())
FAIL(str(e))
+domain.stop()
+
if run["return"] == 0:
FAIL("block-detach failed to detach block device")
-
-
domain = XmTestDomain()
try:
- domain.start()
+ domain.start(noConsole=True)
except DomainError, e:
if verbose:
print e.extra
domain = XmTestDomain(extraConfig=config)
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print e.extra
FAIL("Unable to create domain")
try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
- console.sendInput("input")
run = console.runCmd("cat /proc/partitions | grep hda1")
run2 = console.runCmd("cat /proc/partitions")
except ConsoleError, e:
saveLog(console.getHistory())
FAIL(str(e))
-console.closeConsole()
+domain.closeConsole()
domain.stop()
if run["return"] == 0:
domain = XmTestDomain(extraConfig=config)
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print e.extra
#Verify the block device on DomainU
try:
- console = XmConsole(domain.getName())
-except ConsoleError, e:
- FAIL(str(e))
-
-try:
- console.sendInput("input")
run = console.runCmd("cat /proc/partitions | grep hda1")
except ConsoleError, e:
saveLog(console.getHistory())
FAIL(str(e))
+domain.stop()
+
if run["return"] != 0:
FAIL("Failed to verify that block dev is attached on DomainU")
domain = XmTestDomain()
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print e.extra
#Verify attached block device on DomainU
try:
- console = XmConsole(domain.getName())
-except ConsoleError, e:
- FAIL(str(e))
-
-try:
- console.sendInput("input")
run = console.runCmd("cat /proc/partitions | grep hda1")
except ConsoleError, e:
saveLog(console.getHistory())
FAIL(str(e))
+domain.stop()
+
if run["return"] != 0:
FAIL("Failed to verify that block dev is attached on DomainU")
domain = XmTestDomain(extraConfig=config)
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print e.extra
#Verify attached block device on DomainU
try:
- console = XmConsole(domain.getName())
-except ConsoleError, e:
- FAIL(str(e))
-
-try:
- console.sendInput("input")
run = console.runCmd("cat /proc/partitions | grep hda1;cat /proc/partitions | grep hda2")
except ConsoleError, e:
saveLog(console.getHistory())
FAIL(str(e))
+domain.stop()
+
if run["return"] != 0:
FAIL("Failed to verify that block dev is attached on DomainU")
domain = XmTestDomain()
try:
- domain.start()
+ domain.start(noConsole=True)
except DomainError, e:
if verbose:
print e.extra
domain = XmTestDomain()
try:
- domain.start()
+ domain.start(noConsole=True)
except DomainError, e:
FAIL(str(e))
-try:
- console = XmConsole(domain.getName())
-except ConsoleError, e:
- FAIL(str(e))
-
s, o = traceCommand("xm block-list %s" % domain.getName())
if s != 0:
FAIL("block-list returned !0 when no devices attached")
if o:
FAIL("block-list still shows something after all devices detached!")
-
+domain.stop()
# Start it
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-# Attach a console to it
try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
- FAIL(str(e))
-
-try:
- # Activate the console
- console.sendInput("input")
# Run 'ls'
run = console.runCmd("ls")
except ConsoleError, e:
saveLog(console.getHistory())
FAIL(str(e))
+
+# Save a transcript for human review
+saveLog(console.getHistory())
# Close the console
-console.closeConsole()
+domain.closeConsole()
# Stop the domain (nice shutdown)
domain.stop()
-# Save a transcript for human review
-saveLog(console.getHistory())
-
# Check the output of 'ls'
if not re.search("proc", run["output"]):
#start it
try:
- domain1.start()
+ domain1.start(noConsole=True)
except DomainError, e:
if verbose:
print "Failed to create test domain1 because:"
#start it
eyecatcher = "Pass"
try:
- domain2.start()
+ domain2.start(noConsole=True)
except DomainError, e:
eyecatcher = "Fail"
# Stop the domain1 (nice shutdown)
domain1=XmTestDomain(extraConfig=config1)
try:
- domain1.start()
+ domain1.start(noConsole=True)
eyecatcher1 = "Created"
except DomainError, e:
eyecatcher1 = "Fail"
domain2=XmTestDomain(extraConfig=config2)
try:
- domain2.start()
+ domain2.start(noConsole=True)
eyecatcher2 = "Created"
except DomainError, e:
eyecatcher2 = "Fail"
#start it
try:
- domain_mem64.start()
+ domain_mem64.start(noConsole=True)
except DomainError, e:
if verbose:
print "Failed to create test domain_mem64 because:"
#start it
try:
- domain_mem128.start()
+ domain_mem128.start(noConsole=True)
except DomainError, e:
if verbose:
print "Failed to create test domain_mem128 because:"
#start it
try:
- domain_mem256.start()
+ domain_mem256.start(noConsole=True)
except DomainError, e:
if verbose:
print "Failed to create test domain_mem256 because:"
for i in range(0,50):
domain = XmTestDomain("testdomain")
try:
- domain.start()
+ domain.start(noConsole=True)
except DomainError,e:
print "Failed: " + e.extra
NSPerror = check_for_NSP_error(e.extra)
extraConfig={"memory":MEM_PER_DOM})
try:
- dom.start()
+ cons = dom.start()
except DomainError, e:
if verbose:
print str(e)
FAIL("[%i] Failed to create domain" % d)
try:
- cons = XmConsole(dom.getName())
- cons.sendInput("foo")
cons.runCmd("ls")
except ConsoleError, e:
FAIL("[%i] Failed to attach console to %s" % (d, dom.getName()))
dom = XmTestDomain(extraConfig={"memory" : MEM})
try:
- dom.start()
+ cons = dom.start()
except DomainError, e:
if verbose:
print str(e)
FAIL("Failed to start %s" % dom.getName())
- try:
- cons = XmConsole(dom.getName())
- cons.sendInput("foo")
- except ConsoleError, e:
- FAIL(str(e))
-
if verbose:
print "[%i/%i] Started %s" % (i, DOMS, dom.getName())
if run["return"] != 0:
FAIL("Domain %s didn't survive!" % d.getName())
-
domain = XmTestDomain(extraConfig=config)
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
FAIL("(%i nics) " % i + str(e))
try:
- console = XmConsole(domain.getName())
- console.sendInput("input")
console.runCmd("ls")
except ConsoleError, e:
FAIL("(%i nics) Console didn't respond: probably crashed!" % i)
domain = XenDomain(name=domConfig.getOpt("name"), config=domConfig)
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
FAIL(str(e))
#waitForBoot()
-try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
- FAIL(str(e))
-
try:
# console.debugMe = True
- console.sendInput("foo")
run = console.runCmd("ls")
except ConsoleError, e:
"extra" :"mem=%iM" % MEM})
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
FAIL("Unable to start a domain with %i MB" % MEM)
try:
- console = XmConsole(domain.getName())
- console.sendInput("input")
console.runCmd("ls")
except ConsoleError, e:
if e.reason == RUNAWAY:
"extra" :"mem=%iM" % MEM})
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
FAIL("Unable to start a domain with %i MB" % MEM)
try:
- console = XmConsole(domain.getName())
- console.sendInput("input")
console.runCmd("ls")
except ConsoleError, e:
if e.reason == RUNAWAY:
# Start it
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-# Attach a console to it
try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
- FAIL(str(e))
-
-try:
- # Activate the console
- console.sendInput("foo")
# Run 'ls'
run = console.runCmd("ls")
except ConsoleError, e:
FAIL(str(e))
# Close the console
-console.closeConsole()
+domain.closeConsole()
# Check the output of 'ls'
if not re.search("proc", run["output"]):
# Positive Test:
# Test Description:
# 1. Create a domain
-# 2. Attach a console to the domain.
-# 3. Destroy the domain by id
+# 2. Destroy the domain by id
import sys
import re
# Start it
try:
- domain.start()
+ domain.start(noConsole=True)
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
# Create a domain
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
FAIL(str(e))
- # Attach a console and make sure it's live
try:
- console = XmConsole(domain.getName())
- console.sendInput("foo")
console.runCmd("ls")
except ConsoleError, e:
FAIL(str(e))
domain = XmTestDomain()
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-try:
- console = XmConsole(domain.getName())
-except ConsoleError, e:
- FAIL(str(e))
-
-
status, output = traceCommand("xm list %s" % domain.getName())
if status != 0:
FAIL("`xm list %s' failed with invalid status %i != 0" % (domain.getName(), status))
-console.closeConsole()
+domain.closeConsole()
domain.stop()
# Start it
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-# Attach a console to it
try:
- console = XmConsole(domain.getName())
- console.sendInput("input")
# Make sure it's up an running before we continue
console.runCmd("ls")
except ConsoleError, e:
# quiesce everything
# Close the console
-console.closeConsole()
+domain.closeConsole()
# Stop the domain (nice shutdown)
domain.stop()
domain = XmTestDomain()
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to start domain:"
domain = XmTestDomain()
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to start domain: "
FAIL(str(e))
try:
- console = XmConsole(domain.getName())
- console.sendInput("input")
# Make sure it's alive before we proceed
console.runCmd("ls")
except ConsoleError, e:
# Start it
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-# Attach a console to it
-try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
- FAIL(str(e))
-
try:
- # Activate the console
- console.sendInput("foo")
# Set a variable to check on the other side
run = console.runCmd("foo=bar")
except ConsoleError, e:
FAIL(str(e))
# Close the console
-console.closeConsole()
+domain.closeConsole()
old_domid = domid(domain.getName())
# Attach a console to it
try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
+ console = domain.getConsole()
console.debugMe = True
except ConsoleError, e:
pass
+console.setHistorySaveCmds(value=True)
console.sendInput("ls")
# Run 'ls'
FAIL("Migrated domain has been reset")
# Close the console
-console.closeConsole()
+domain.closeConsole()
# Stop the domain (nice shutdown)
domain.stop()
domain = XmTestDomain()
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-# Attach a console to it
try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
- FAIL(str(e))
-
-try:
- # Activate the console
- console.sendInput("input")
# Run 'ls'
run = console.runCmd("ls")
except ConsoleError, e:
##
# Close the console
-console.closeConsole()
+domain.closeConsole()
# Stop the domain (nice shutdown)
domain.stop()
domain = XmTestDomain()
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-# Attach a console to it
try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
- FAIL(str(e))
-
-try:
- # Activate the console
- console.sendInput("input")
# Run 'ls'
run = console.runCmd("ls")
except ConsoleError, e:
# Close the console
-console.closeConsole()
+domain.closeConsole()
# Stop the domain (nice shutdown)
domain.stop()
domain = XmTestDomain()
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-# Attach a console to it
-try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
- # network-detach is crashing, so we enable console debugging
- # for now, so that reports include the oops
- console.debugMe = True
-except ConsoleError, e:
- FAIL(str(e))
+console.debugMe = True
try:
- # Activate the console
- console.sendInput("input")
# Run 'ls'
run = console.runCmd("ls")
except ConsoleError, e:
FAIL(msg)
# Close the console
-console.closeConsole()
+domain.closeConsole()
# Stop the domain (nice shutdown)
domain.stop()
domain = XmTestDomain(extraConfig=config)
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-
-# Attach a console
-try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
- FAIL(str(e))
-
try:
- # Activate the console
- console.sendInput("bhs")
-
# Bring up the "lo" interface.
console.runCmd("ifconfig lo 127.0.0.1")
domain = XmTestDomain(extraConfig=config)
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-
-# Attach a console
-try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
- FAIL(str(e))
-
try:
- # Activate the console
- console.sendInput("bhs")
-
# Bring up the "lo" interface.
console.runCmd("ifconfig lo 127.0.0.1")
domain = XmTestDomain(extraConfig=config)
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-
-# Attach a console
-try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
- FAIL(str(e))
-
try:
- # Activate the console
- console.sendInput("bhs")
-
# Bring up the "lo" interface.
console.runCmd("ifconfig lo 127.0.0.1")
domain = XmTestDomain(extraConfig=config)
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-
-# Attach a console
-try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
- # Activate the console
- console.sendInput("bhs")
-except ConsoleError, e:
- FAIL(str(e))
-
try:
# Add a suitable dom0 IP address
dom0ip = Net.ip("dom0", "eth0", todomname=domain.getName(), toeth="eth0", bridge=brg)
domain = XmTestDomain(extraConfig=config)
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-
-# Attach a console
-try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
- # Activate the console
- console.sendInput("bhs")
-except ConsoleError, e:
- FAIL(str(e))
-
try:
# Add a suitable dom0 IP address
dom0ip = Net.ip("dom0", "eth0", todomname=domain.getName(), toeth="eth0", bridge=brg)
domain = XmTestDomain(extraConfig=config)
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-
-# Attach a console
-try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
- # Activate the console
- console.sendInput("bhs")
-except ConsoleError, e:
- FAIL(str(e))
-
try:
# Add a suitable dom0 IP address
dom0ip = Net.ip("dom0", "eth0", todomname=domain.getName(), toeth="eth0", bridge=brg)
dom = XmTestDomain(extraConfig=config)
try:
- dom.start()
+ console = dom.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
- try:
- # Attach a console
- console = XmConsole(dom.getName(), historySaveCmds=True)
- # Activate the console
- console.sendInput("bhs")
- except ConsoleError, e:
- FAIL(str(e))
return console
rc = 0
dom = XmTestDomain(extraConfig=config)
try:
- dom.start()
+ console = dom.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
- try:
- # Attach a console
- console = XmConsole(dom.getName(), historySaveCmds=True)
- # Activate the console
- console.sendInput("bhs")
- except ConsoleError, e:
- FAIL(str(e))
return console
rc = 0
dom = XmTestDomain(extraConfig=config)
try:
- dom.start()
+ console = dom.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
- try:
- # Attach a console
- console = XmConsole(dom.getName(), historySaveCmds=True)
- # Activate the console
- console.sendInput("bhs")
- except ConsoleError, e:
- FAIL(str(e))
return console
rc = 0
# Start it
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-# Attach a console to it
try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
- FAIL(str(e))
-
-try:
- # Activate the console
- console.sendInput("foo")
# Make sure a command succeeds
run = console.runCmd("ls")
except ConsoleError, e:
FAIL(str(e))
# Close the console
-console.closeConsole()
+domain.closeConsole()
# Pause the domain
status, output = traceCommand("xm pause %s" % domain.getName())
# Try to attach a console to it
try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
+ console = domain.getConsole()
+ console.setHistorySaveCmds(value=True)
run = console.runCmd("ls")
#If we get here, console attached to paused domain (unexpected)
FAIL("console attached to supposedly paused domain")
pass
# Close the console
-console.closeConsole()
+domain.closeConsole()
status, output = traceCommand("xm unpause %s" % domain.getName())
if status != 0:
domain = XmTestDomain()
try:
- domain.start()
+ domain.start(noConsole=True)
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
domain = XmTestDomain()
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-try:
- console = XmConsole(domain.getName())
-except ConsoleError, e:
- FAIL(str(e))
-
-console.closeConsole()
+domain.closeConsole()
status, output = traceCommand("xm reboot %s" % domain.getName())
time.sleep(15)
try:
- console = XmConsole(domain.getName())
+ console = domain.getConsole()
except ConsoleError, e:
FAIL(str(e))
except ConsoleError, e:
FAIL(str(e))
-console.closeConsole()
+domain.closeConsole()
domain.destroy()
domain = XmTestDomain()
try:
- domain.start()
+ domain.start(noConsole=True)
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
domain = XmTestDomain()
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
# Make sure the domain isn't DOA
try:
- console = XmConsole(domain.getName())
- console.sendInput("input")
console.runCmd("foo=bar")
except ConsoleError, e:
FAIL(str(e))
-console.closeConsole()
+domain.closeConsole()
# Save it out
try:
# Make sure it's alive
try:
- newConsole = XmConsole(domain.getName())
+ newConsole = domain.getConsole()
# Enable debug dumping because this generates a Oops on x86_64
newConsole.debugMe = True
newConsole.sendInput("ls")
except ConsoleError, e:
FAIL("Restored domain is dead (%s)" % str(e))
-newConsole.closeConsole()
+domain.closeConsole()
# This only works because the domain
# still has the same name
FAIL("Unable to mke2fs /dev/ram1 in dom0")
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
FAIL(str(e))
try:
- console = XmConsole(domain.getName())
- console.sendInput("foo")
-
run = console.runCmd("mkdir /mnt/a /mnt/b")
if run["return"] != 0:
FAIL("Unable to mkdir /mnt/a /mnt/b")
except ConsoleError, e:
FAIL(str(e))
-console.closeConsole()
+domain.closeConsole()
try:
s, o = traceCommand("xm save %s /tmp/test.state" % domain.getName(),
FAIL("xm restore exited with %i != 0" % s)
try:
- console = XmConsole(domain.getName())
+ console = domain.getConsole()
# Enable debug dumping, as this causes an Oops on x86_64
console.debugMe = True
domain = XmTestDomain()
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-# Make sure the domain isn't DOA
-try:
- console = XmConsole(domain.getName())
-except ConsoleError, e:
- FAIL(str(e))
-
-console.closeConsole()
+domain.closeConsole()
# Save it out
try:
domain = XmTestDomain()
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-# Make sure the domain isn't DOA
-try:
- console = XmConsole(domain.getName())
-except ConsoleError, e:
- FAIL(str(e))
-
-console.closeConsole()
+domain.closeConsole()
# Save it out
status, output = traceCommand("xm save %s /NOWHERE/test.state" % domain.getName())
domain = XmTestDomain(extraConfig = {"sched":"sedf"})
try:
- domain.start()
+ domain.start(noConsole=True)
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
domain = XmTestDomain(extraConfig = {"sched":"sedf"})
try:
- domain.start()
+ domain.start(noConsole=True)
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
domain = XmTestDomain(extraConfig = {"sched":"sedf"})
try:
- domain.start()
+ domain.start(noConsole=True)
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
domain = XmTestDomain(extraConfig = {"sched":"sedf"})
try:
- domain.start()
+ domain.start(noConsole=True)
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
domain = XmTestDomain(extraConfig = {"sched":"sedf"})
try:
- domain.start()
+ domain.start(noConsole=True)
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
domain = XmTestDomain(extraConfig = {"sched":"sedf"})
try:
- domain.start()
+ domain.start(noConsole=True)
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
# Start it
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-# Attach a console to it
try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
- FAIL(str(e))
-
-try:
- # Activate the console
- console.sendInput("foo")
# Make sure a command succeeds
run = console.runCmd("ls /bin")
except ConsoleError, e:
FAIL(str(e))
# Close the console
-console.closeConsole()
+domain.closeConsole()
# Stop the domain (nice shutdown)
status, output = traceCommand("xm shutdown %s" % domain.getName())
# Start it
try:
- domain.start()
+ domain.start(noConsole=True)
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
# Start it
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-# Attach a console to it
-try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
- FAIL(str(e))
-
-
status, output = traceCommand("xm sysrq %s s" % domain.getName())
if status != 0:
# Run 'ls'
try:
- # Activate the console
- console.sendInput("foo")
# Check the dmesg output on the domU
run = console.runCmd("dmesg | grep Emerg\n")
except ConsoleError, e:
FAIL(str(e))
# Close the console
-console.closeConsole()
+domain.closeConsole()
# Stop the domain (nice shutdown)
domain.stop()
domain = XmTestDomain()
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create domain:"
# Wait for the reboot to finish
time.sleep(20)
-try:
- console = XmConsole(domain.getName())
- console.sendInput("input")
-except ConsoleError, e:
- FAIL(str(e))
-
status, output = traceCommand("xm sysrq %s s" % domain.getName())
if status != 0:
FAIL("sysrq failed with %i != 0" % status)
# Start it
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
print e.extra
FAIL(str(e))
-# Attach a console to it
try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
- FAIL(str(e))
-
-try:
- # Activate the console
- console.sendInput("foo")
# Make sure a command succeeds
run = console.runCmd("ls")
except ConsoleError, e:
FAIL(str(e))
# Close the console
-console.closeConsole()
+domain.closeConsole()
seed(time.time())
# Are we still alive after all that?
try:
- console = XmConsole(domain.getName(), historySaveCmds=True)
+ console = domain.getConsole()
run = console.runCmd("ls")
except ConsoleError, e:
FAIL(str(e))
# Close the console
-console.closeConsole()
+domain.closeConsole()
if run["return"] != 0:
FAIL("console failed to attach to supposedly unpaused domain")
domain = XmTestDomain(extraConfig={"vcpus":2})
try:
- domain.start()
+ domain.start(noConsole=True)
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
domain = XmTestDomain()
try:
- domain.start()
+ domain.start(noConsole=True)
except DomainError, e:
if verbose:
print "Failed to create test domain because:"
domain = XmTestDomain(extraConfig=config)
try:
- domain.start()
+ domain.start(noConsole=True)
except DomainError, e:
if verbose:
print e.extra
domain = XmTestDomain(extraConfig=config)
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print e.extra
domName = domain.getName()
-try:
- console = XmConsole(domain.getName())
-except ConsoleError, e:
- vtpm_cleanup(domName)
- FAIL(str(e))
-
try:
console.sendInput("input")
except ConsoleError, e:
vtpm_cleanup(domName)
FAIL("TPM frontend support not compiled into (domU?) kernel")
-console.closeConsole()
+domain.closeConsole()
domain.stop()
config = {"vtpm":"instance=1,backend=0"}
domain = XmTestDomain(extraConfig=config)
+consoleHistory = ""
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print e.extra
domName = domain.getName()
-try:
- console = XmConsole(domain.getName())
-except ConsoleError, e:
- vtpm_cleanup(domName)
- FAIL(str(e))
-
try:
console.sendInput("input")
except ConsoleError, e:
vtpm_cleanup(domName)
FAIL("TPM frontend support not compiled into (domU?) kernel")
-console.closeConsole()
+consoleHistory = console.getHistory()
+domain.closeConsole()
try:
status, ouptut = traceCommand("xm save %s %s.save" %
(domName, domName),
timeout=30)
+
except TimeoutError, e:
- saveLog(console.getHistory())
+ saveLog(consoleHistory)
vtpm_cleanup(domName)
FAIL(str(e))
if status != 0:
- saveLog(console.getHistory())
+ saveLog(consoleHistory)
vtpm_cleanup(domName)
FAIL("xm save did not succeed")
timeout=30)
except TimeoutError, e:
os.remove("%s.save" % domName)
- saveLog(console.getHistory())
+ saveLog(consoleHistory)
vtpm_cleanup(domName)
FAIL(str(e))
os.remove("%s.save" % domName)
if status != 0:
- saveLog(console.getHistory())
+ saveLog(consoleHistory)
vtpm_cleanup(domName)
FAIL("xm restore did not succeed")
try:
- console = XmConsole(domain.getName())
+ console = domain.getConsole()
except ConsoleError, e:
vtpm_cleanup(domName)
FAIL(str(e))
vtpm_cleanup(domName)
FAIL(str(e))
-console.closeConsole()
+domain.closeConsole()
domain.stop()
config = {"vtpm":"instance=1,backend=0"}
domain = XmTestDomain(extraConfig=config)
+consoleHistory = ""
try:
- domain.start()
+ console = domain.start()
except DomainError, e:
if verbose:
print e.extra
domName = domain.getName()
-try:
- console = XmConsole(domain.getName())
-except ConsoleError, e:
- vtpm_cleanup(domName)
- FAIL(str(e))
-
try:
console.sendInput("input")
except ConsoleError, e:
vtpm_cleanup(domName)
FAIL("TPM frontend support not compiled into (domU?) kernel")
-console.closeConsole()
+consoleHistory = console.getHistory()
+domain.closeConsole()
old_domid = domid(domName)
domName,
timeout=90)
except TimeoutError, e:
- saveLog(console.getHistory())
+ saveLog(consoleHistory)
vtpm_cleanup(domName)
FAIL(str(e))
if status != 0:
- saveLog(console.getHistory())
+ saveLog(consoleHistory)
vtpm_cleanup(domName)
FAIL("xm migrate did not succeed. External device migration activated?")
FAIL("xm migrate failed, domain id is still %s" % old_domid)
try:
- console = XmConsole(domain.getName())
+ console = domain.getConsole()
except ConsoleError, e:
vtpm_cleanup(domName)
FAIL(str(e))
vtpm_cleanup(domName)
FAIL(str(e))
-console.closeConsole()
+domain.closeConsole()
domain.stop()